package com.ants.modules.wxManage.service.impl;

import com.ants.common.utils.AntsUtils;
import com.ants.modules.wxManage.entity.AntsWxSwiper;
import com.ants.modules.wxManage.mapper.AntsWxSwiperMapper;
import com.ants.modules.wxManage.service.AntsWxSwiperService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * TODO
 * Author Chen
 * Date   2021/9/7 18:44
 */
@Service
public class AntsWxSwiperServiceImpl extends ServiceImpl<AntsWxSwiperMapper, AntsWxSwiper> implements AntsWxSwiperService {

    @Override
    public IPage<Map<String, String>> selectArticle(String title, Integer pageNo, Integer pageSize) {
        IPage<Map<String, String>> page = new Page<>();
        pageNo = AntsUtils.pageNo(pageNo, pageSize);
        List<Map<String, String>> list = baseMapper.selectArticle(title,pageNo, pageSize);
        Integer total = baseMapper.selectArticleCount(title);
        page.setRecords(list);
        page.setTotal(total);
        return page;
    }

    @Override
    public List<Map<String, String>> getHomeSwiper() {
        return baseMapper.getHomeSwiper();
    }

    @Override
    public List<Map<String, String>> queryHotLableBySize(Integer pageSize) {
        return baseMapper.queryHotLableBySize(pageSize);
    }
}
